import request from '@/utils/unirequest';
import type { LuchResponse } from '@/type/common';

// 消息通知查询参数接口
export interface ISysNotificationQuery {
  CategoryId?: string | null;
  Status?: string | null;
  Priority?: string | null;
  Limit?: number;
  Page?: number;
}

// 消息通知基础接口
export interface ISysNotification {
  BillCode: string | null;
  ID?: string | null;
  Title: string | null;
  Content: string | null;
  RouteId: null;
  Route?: any;
  CategoryId: null;
  Category?: any;
  BusinessType: string | null;
  BusinessId: string | null;
  SenderName: string | null;
  ReceiverName: string | null;
  Status: '未读' | '已读';
  Priority: '低' | '普通' | '高' | '紧急';
  IsTop: boolean;
  SendTime: Date;
  ReadTime: Date | null;
}

export interface ISysNotificationView extends ISysNotification {
  // 可以添加视图特有的字段
}

// 主包专用的消息通知API - 只包含search方法
export default function SysNotificationMainApi() {
  return {
    // 搜索消息通知
    async search(data: ISysNotificationQuery): Promise<LuchResponse<ISysNotificationView[]>> {
      return await request.post('/api/SysNotification/Search', data);
    },
  };
}
